import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/res/gaps.dart';
import 'package:ls_work/viewmodel/service_order/service_item_list_view_model.dart';

class ServiceItemListPage extends  BaseStatefulMvvmWidget{
  @override
  State<StatefulWidget> createState() => _ServiceItemListState();

}

class _ServiceItemListState extends BaseMvvmListState<ServiceItemListViewModel,ServiceItemListPage>{
  @override
  Widget buildRootView(BuildContext context, Widget loadingContentWidget) {
    return Scaffold(
      appBar: AppBar(
        title: Text('选择服务项目'),
      ),
      body: loadingContentWidget,
    );
  }

  @override
  Widget createItemWidget(int index) {
    var item = viewModel.listItems[index];
    return IconTitleTextWidget(item.name??"").onTap(() { finish(result: item);});
  }

  @override
  Widget get separatorDivider => Gaps.dividerLine;

  @override
  ServiceItemListViewModel createViewModel() {
    return ServiceItemListViewModel(context);
  }

  @override
  bool get canPullUp => false;

}